Skip to content

Comments

feat(nav-tab): require aria-label(ledby) or label#748

Open
nataliadelmar wants to merge 2 commits intomomentum-design:masterfrom
nataliadelmar:NavTabLabel
Open

feat(nav-tab): require aria-label(ledby) or label#748
nataliadelmar wants to merge 2 commits intomomentum-design:masterfrom
nataliadelmar:NavTabLabel

Conversation

@nataliadelmar
Copy link
Collaborator

It is important that, when the NavTab is not expanded, the circular button remains with an aria-label.
To prevent that, we are making aria-label(ledby) or label required and using it to label the nav tab in case it is not expanded.

Non-breaking change in Cantina as all instances of NavigationTab have aria-labels 🎉

@nataliadelmar nataliadelmar added the validated If the pull request is validated automation. label Jan 6, 2025
const NavigationTab: FC<Props> = (props: Props) => {
const { icon, label, count = 0, className, id, size, style, active, ...otherProps } = props;

const isExpanded = size == 200;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is a copy-paste, but I think our convention is always to use triple equals

data-size={size || DEFAULTS.SIZE}
id={id}
style={style}
aria-label={isExpanded && label ? props['aria-label'] : props['aria-label'] || label} // if expanded with label, the accessible name will default to the visible label inside.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get what you're doing here

data-size={size || DEFAULTS.SIZE}
id={id}
style={style}
aria-label={isExpanded && label ? props['aria-label'] : props['aria-label'] || label} // if expanded with label, the accessible name will default to the visible label inside.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And you've not added any unit tests for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated If the pull request is validated automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants